package be.pollsg1.service.impl;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;

import be.pollsg1.entity.User;
import be.pollsg1.repositories.UserRepositotyRemote;
import be.pollsg1.service.UserServiceBusinessLocal;
import be.pollsg1.service.UserServiceBusinessRemote;

@Stateless
public class UserServiceBusiness implements UserServiceBusinessLocal,
		UserServiceBusinessRemote {
	@EJB
	private	UserRepositotyRemote userRepository;
	
	@Override
	public User findById(Long id) {
		User user = userRepository.findById(id);
		return user;
	}

	@Override
	public User insert(User user) {
		return userRepository.insert(user);
	}

	@Override
	public User update(User user) {
		return userRepository.update(user);
	}

	@Override
	public void  delete(User user) {
	    userRepository.delete(user);
	}

	@Override
	public List<User> findAll() {
		return userRepository.findAll();
	}

	@Override
	public boolean authentification(String username, String password) {
		return userRepository.authentification(username, password);
	}

}
